<?php
/**
 * 从文件去出所有邮件,去除重复,写到新的文件中去
 */
set_time_limit(0);
$s = microtime(true);
//从文件中读,然后放到数组
$file = fopen ( "link.txt", "r" );
if(!$file){
	echo "文件打不开或不存在";
	exit;
}
$array = array();
while ( !feof($file) ){
	$array[] = trim(fgets($file));
}
fclose($file);

//去重后写到新到新的文件中
$file8 = fopen("news.txt", "a");
foreach (array_unique($array) as $value) {
	fwrite($file8, "{$value}\r\n");
}
fclose($file8);

echo "用时:".number_format(microtime(true) - $s, 3, '.', '')."秒";